<!--
	作者：2575202388@qq.com
	时间：2019年8月6日17:11:53
	描述：书籍管理-题目管理
-->

<template>
	<Modal title="心得体会审核" v-model="modal0" width="1200px" footer-hide @onCancel="closemodel">
		<div style="width:100%;">
			<div style="background: #fff;">
				<div style="width:100%;float:left;padding-top: 10px;padding-bottom: 10px;">
					<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">关键字：</div>
					<div style="width:12%;float:left;">
						<Input v-model="tj.keyword"  clearable  style="width: 90%;float:left;" />
					</div>
					<div style="width:30%;text-align: left;float:left;">
						<Button v-on:click="search()" style="margin-left:1%;background: #ffa500;color:#fff;border:1px solid #ffa500;">搜索</Button>
						<Button v-on:click="plsh()" style="margin-left:1%;background: #ffa500;color:#fff;border:1px solid #ffa500;">批量审核</Button>
					</div>
				</div>
			</div>
			<ss :tj="tj" ref="xdthss" @getSelection="getSelection"></ss>
			<setshzt ref="setshzt" @setshzt="setshzt"></setshzt>
		</div>
	</Modal>
</template>

<script>
	import ss from "./ss";
	import setshzt from "./setshzt";
	export default {
		name: "xdthmanage",
		props: {
    		bid:{
    			type: String
    		},	
    	},
		data() {
			return {
				tj: {
					keyword:'',//关键字
					bid:'',
				},
				modal0:false,
					selects:[],
			}
		},
		methods: {
			search(){
				this.$refs.xdthss.load();
			}, 
			closemodel(){
				this.modal0=false;
			},
			
			plsh(){
				var warr=[];
	      		const sels=this.selects;
	      		for(var i=0;i<sels.length;i++){
	      			warr.push(sels[i].DISID);
	      		}
	      		if(warr.length<=0){
	      			this.$Modal.error({
                        title: "提示",
                        content: "请选择需要进行审核的评论！"
                   });	
                   return;
	      		}
	      		
				this.$refs.setshzt.modal0=true;
			},
			
			setshzt(sh){
				var warr=[];
	      		const sels=this.selects;
	      		for(var i=0;i<sels.length;i++){
	      			warr.push(sels[i].DISID);
	      		}
	      		const params={
					disids:JSON.stringify(warr),
					sh:sh
				};
				this.$http.post("/host/readbook/sjgl/dicussPlSh.html",params)
				.then(result => {
					if(result){
						this.$Modal.success({
                            title: "提示",
                            content: "审核成功！"
                       });
                       this.$refs.setshzt.modal0=false;
                       this.search(); 
					}else{
						this.$Modal.error({
                            title: "提示",
                            content: "审核失败，请联系管理员！"
                        });	
					}
				});
			},
			
			getSelection(selects){
	      		this.selects=[...selects];
	      	},
		},
		components: {
			ss,
			setshzt
		},
		mounted(){
		},
		watch:{
			modal0(news,olds){
				if(!news){
					this.tj={
						keyword:'',//关键字
						bid:'',
					};
					this.$emit("reload");   
				}else{
					this.tj={
						keyword:'',//关键字
						bid:this.bid,
					};
				}
			}
		},
		computed: {
			
		}
	}
</script>

<style>
</style>